package models.general;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.util.HashSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: olgak
 * Date: 7.5.2013
 * Time: 15:02
 * To change this template use File | Settings | File Templates.
 */
public class StringIntegerClass {
    public String bookName;
    public int index;

    public StringIntegerClass() {
    }

    public StringIntegerClass(String bookName, int index) {
        this.bookName = bookName;
        this.index = index;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj.getClass() != getClass()) {
            return false;
        }
        StringIntegerClass s = (StringIntegerClass) obj;
        if (this.bookName == s.bookName && this.index==s.index) {
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        return new HashCodeBuilder(index%2==0?index+1:index, PRIME).
                toHashCode();
    }

}
